<script>
export default {
  name: 'LayoutView',
  data() {
    return {
      rootActiveRouter: ""
    }
  },
  mounted() {
    // 获取当前所有路由，选择子路由的name
    this.rootActiveRouter = this.$route.matched[1].name
  }
}
</script>

<template>
  <div>
    <!--顶部菜单-->
    <el-menu mode="horizontal" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b"
             :default-active="rootActiveRouter" router>
      <el-menu-item index="1">媒体宝系统</el-menu-item>
      <el-menu-item index="Task" :route="{name:'ActivityList'}">任务宝</el-menu-item>
      <el-menu-item index="Msg" :route="{name:'Push'}">消息宝</el-menu-item>
      <el-menu-item index="Auth" :route="{name:'Auth'}">授权</el-menu-item>
      <el-submenu index="5" style="float: right">
        <template slot="title">用户</template>
        <el-menu-item index="5-1">个人中心</el-menu-item>
        <el-menu-item index="5-2">注销</el-menu-item>
      </el-submenu>
    </el-menu>

    <router-view></router-view>
  </div>
</template>

<style scoped>

</style>